Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs for form-associated custom elements in Stencil #1247

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

alicewriteswrongs
Copy link
Contributor

This adds documentation of:

@alicewriteswrongs alicewriteswrongs requested a review from a team as a code owner October 9, 2023 19:09
@alicewriteswrongs alicewriteswrongs requested review from rwaskiewicz and tanner-reits and removed request for a team October 9, 2023 19:09
@vercel
Copy link

vercel bot commented Oct 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stencil-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 16, 2023 2:04pm

Copy link
Contributor

@rwaskiewicz rwaskiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good start!

One larger question I have is how this would interact with our guide for forms - https://stencil-docs-git-ap-form-associated-ionic1.vercel.app/docs/next/forms. Should we update that as well?

Copy link
Contributor

@tanner-reits tanner-reits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One super small grammatical fix

Copy link
Contributor

@rwaskiewicz rwaskiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - FWIW, you have one (non-version related) typo, but non-blocking

alicewriteswrongs added a commit to stenciljs/core that referenced this pull request Oct 16, 2023
This adds support for building form-associated custom elements in
Stencil components, allowing Stencil components to participate in HTML
forms in a rich manner. This is a popular request in the Stencil
community (see #2284).

A minimal Stencil component that uses the new APIs to integrate with a
form could look like this:

```tsx
import { Component, h, AttachInternals } from '@stencil/core';

@component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
  formAssociated: true
})
export class MyComponent {
  @AttachInternals() internals: ElementInternals;

  render() {
    return <div>Hello, World!</div>;
  }
}
```

The new form-association technology is exposed to the

- A new option called `formAssociated` has been added to the
  [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55)
  interface.
- A new `@AttachInternals()` decorator can be used to indicate a
  property on a Stencil component to which an
  [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
  object will be bound at runtime.
- Using `@AttachInternals()` is supported both for lazy builds
  ([`www`](https://stenciljs.com/docs/www),
  [`dist`](https://stenciljs.com/docs/distribution)) as well as for
  [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements).

The new behavior is implemented at compile-time, and so should result in
only very minimal increases in code / bundle size. Support exists for
using form-associated components in both the lazy and the CE output
targets, as well as some extremely minimal provisions for testing.

Documentation for this feature was added to the Stencil site here:
stenciljs/site#1247
alicewriteswrongs added a commit to stenciljs/core that referenced this pull request Oct 16, 2023
This adds support for building form-associated custom elements in
Stencil components, allowing Stencil components to participate in HTML
forms in a rich manner. This is a popular request in the Stencil
community (see #2284).

A minimal Stencil component that uses the new APIs to integrate with a
form could look like this:

```tsx
import { Component, h, AttachInternals } from '@stencil/core';

\@component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
  formAssociated: true
})
export class MyComponent {
  @AttachInternals() internals: ElementInternals;

  render() {
    return <div>Hello, World!</div>;
  }
}
```

The new form-association technology is exposed to the

- A new option called `formAssociated` has been added to the
  [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55)
  interface.
- A new `@AttachInternals()` decorator can be used to indicate a
  property on a Stencil component to which an
  [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
  object will be bound at runtime.
- Using `@AttachInternals()` is supported both for lazy builds
  ([`www`](https://stenciljs.com/docs/www),
  [`dist`](https://stenciljs.com/docs/distribution)) as well as for
  [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements).

The new behavior is implemented at compile-time, and so should result in
only very minimal increases in code / bundle size. Support exists for
using form-associated components in both the lazy and the CE output
targets, as well as some extremely minimal provisions for testing.

Documentation for this feature was added to the Stencil site here:
stenciljs/site#1247
alicewriteswrongs added a commit to stenciljs/core that referenced this pull request Oct 16, 2023
This adds support for building form-associated custom elements in
Stencil components, allowing Stencil components to participate in HTML
forms in a rich manner. This is a popular request in the Stencil
community (see #2284).

The new form-association technology is exposed to the component author
via the following changes:

- A new option called `formAssociated` has been added to the
  [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55)
  interface.
- A new `@AttachInternals()` decorator can be used to indicate a
  property on a Stencil component to which an
  [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
  object will be bound at runtime.
- Using `@AttachInternals()` is supported both for lazy builds
  ([`www`](https://stenciljs.com/docs/www),
  [`dist`](https://stenciljs.com/docs/distribution)) as well as for
  [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements).

The new behavior is implemented at compile-time, and so should result in
only very minimal increases in code / bundle size. Support exists for
using form-associated components in both the lazy and the CE output
targets, as well as some extremely minimal provisions for testing.

Documentation for this feature was added to the Stencil site here:
stenciljs/site#1247
Form-associated custom elements were added to Stencil in
stenciljs/core#4784 for version 4.5.0. This
adds documentation explaining the changes to the component authoring DSL
and also breaking down some examples of how the functionality could be
used to build out a component.
github-merge-queue bot pushed a commit to stenciljs/core that referenced this pull request Oct 16, 2023
)

This adds support for building form-associated custom elements in
Stencil components, allowing Stencil components to participate in HTML
forms in a rich manner. This is a popular request in the Stencil
community (see #2284).

The new form-association technology is exposed to the component author
via the following changes:

- A new option called `formAssociated` has been added to the
  [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55)
  interface.
- A new `@AttachInternals()` decorator can be used to indicate a
  property on a Stencil component to which an
  [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
  object will be bound at runtime.
- Using `@AttachInternals()` is supported both for lazy builds
  ([`www`](https://stenciljs.com/docs/www),
  [`dist`](https://stenciljs.com/docs/distribution)) as well as for
  [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements).

The new behavior is implemented at compile-time, and so should result in
only very minimal increases in code / bundle size. Support exists for
using form-associated components in both the lazy and the CE output
targets, as well as some extremely minimal provisions for testing.

Documentation for this feature was added to the Stencil site here:
stenciljs/site#1247
@alicewriteswrongs alicewriteswrongs merged commit 57b9080 into main Oct 16, 2023
@alicewriteswrongs alicewriteswrongs deleted the ap/form-associated branch October 16, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants